<template>
  <div id="app">
    <el-container>
      <el-header class="nav">
        <el-menu
          :default-active="activeIndex2"
          class="el-menu-demo"
          mode="horizontal"
          @select="handleSelect"
          background-color="#545c64"
          text-color="#fff"
          active-text-color="#ffd04b"
        >
        
          <el-menu-item index="/">首页</el-menu-item>
          <el-submenu index="2">
            <template slot="title">我的工作台</template>
            <el-menu-item index="/about">about</el-menu-item>
            <el-menu-item index="/my">my</el-menu-item>
            <el-menu-item index="/my0">my-my0</el-menu-item>
            <el-menu-item index="/my1">my-my1</el-menu-item>
            <el-submenu index="2-4">
              <template slot="title">选项4</template>
              <el-menu-item index="2-4-1">选项1</el-menu-item>
              <el-menu-item index="2-4-2">选项2</el-menu-item>
              <el-menu-item index="2-4-3">选项3</el-menu-item>
            </el-submenu>
          </el-submenu>
          <el-menu-item index="3" disabled>消息中心</el-menu-item>
          <el-menu-item index="4"
            ><a href="https://www.ele.me" target="_blank"
              >订单管理</a
            ></el-menu-item
          >
        </el-menu>
        <!-- Form -->
        <div class="right">
          <el-button type="primary" @click="dialogFormVisible = true"
            >登录</el-button
          >
          <el-button type="danger">注册</el-button>
        </div>
      </el-header>
      <el-row :gutter="20" type="flex" class="row-bg" justify="center">
        <el-col :span="4" class="el-aside">Aside</el-col>
        <el-col :span="20">
          <!-- 路由视图 -->
          <router-view />
        </el-col>
      </el-row>
    </el-container>

    <el-dialog title="收货地址" :visible.sync="dialogFormVisible">
      <el-form :model="form">
        <el-form-item label="活动名称" label-width="100">
          <el-input v-model="form.name" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="活动区域" label-width="100">
          <el-select v-model="form.region" placeholder="请选择活动区域">
            <el-option label="区域一" value="shanghai"></el-option>
            <el-option label="区域二" value="beijing"></el-option>
          </el-select>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogFormVisible = false">取 消</el-button>
        <el-button type="primary" @click="dialogFormVisible = false"
          >确 定</el-button
        >
      </div>
    </el-dialog>
  </div>
</template>
<script>
export default {
  data() {
    return {
      activeIndex: "1",
      activeIndex2: "1",
      dialogFormVisible: false,
      form: {
        name: "",
        region: "",
      },
    };
  },
  methods: {
    handleSelect(key, keyPath) {
      this.$router.push(
        { path: key },
        () => {},
        () => {}
      );
    },
  },
};
</script>
<style lang="scss">
.right {
  display: flex;
  align-items: center;
}
.nav {
  position: sticky;
  z-index: 99999;
  top: 0px;
  justify-content: space-between;
  display: flex;
  background-color: #545c64;
  color: #fff;
}
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
}

nav {
  padding: 30px;

  a {
    font-weight: bold;
    color: #2c3e50;

    &.router-link-exact-active {
      color: #42b983;
    }
  }
}
.el-aside {
  background-color: #d3dce6;
  color: #333;
  text-align: center;
  line-height: 200px;
}
body {
  margin: 0px;
}
header.el-header {
  padding: 0px;
}
</style>
